// 初始化按钮状态

export default function updateButtonStatus(orgVal, isEdit) {
    const optionData = this.props.editTable.getAllRows('contopiniongrid', true);
    const flag = !(optionData && optionData.length);
    this.props.button.setButtonVisible({
        add: !!(orgVal.refpk && !isEdit),
        query: !!(orgVal.refpk && !isEdit),
        edit: !!(orgVal.refpk && !isEdit),
        delete: !!(orgVal.refpk && !isEdit),
        renewal: !!(orgVal.refpk && !isEdit),
        stop: !!(orgVal.refpk && !isEdit),
        sendMsg: !!(orgVal.refpk && !isEdit),
        print: !!(orgVal.refpk && !isEdit),
        refresh: !!(orgVal.refpk && !isEdit),
        save: !!(orgVal.refpk && isEdit),
        cancel: !!(orgVal.refpk && isEdit)
    });

    this.props.button.setButtonDisabled({
        edit: flag,
        delete: flag,
        renewal: flag,
        stop: flag,
        print: flag
    });
}
